<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Sign a message</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="function.sodium-crypto-sign-verify-detached.html">« sodium_crypto_sign_verify_detached</a></li>
      <li style="float: right;"><a href="function.sodium-crypto-stream-keygen.html">sodium_crypto_stream_keygen »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="ref.sodium.html">Sodium 函数</a></li>
    <li>Sign a message</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="function.sodium-crypto-sign" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">sodium_crypto_sign</h1>
  <p class="verinfo">(PHP 7 &gt;= 7.2.0, PHP 8)</p><p class="refpurpose"><span class="refname">sodium_crypto_sign</span> &mdash; <span class="dc-title">Sign a message</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.sodium-crypto-sign-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>sodium_crypto_sign</strong></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$message</code></span>, <span class="methodparam"><span class="type">string</span> <code class="parameter">$secret_key</code></span>): <span class="type">string</span></div>

  <p class="para rdfs-comment">
   Sign a message with a secret key, that can be verified by the corresponding public key.
   This function attaches the signature to the message. See <span class="function"><a href="function.sodium-crypto-sign-detached.html" class="function">sodium_crypto_sign_detached()</a></span>
   for detached signatures.
  </p>

 </div>


 <div class="refsect1 parameters" id="refsect1-function.sodium-crypto-sign-parameters">
  <h3 class="title">参数</h3>
  <dl>
   
    <dt>
<code class="parameter">message</code></dt>

    <dd>

     <p class="para">
      Message to sign.
     </p>
    </dd>

   
   
    <dt>
<code class="parameter">secret_key</code></dt>

    <dd>

     <p class="para">
      Secret key. See <span class="function"><a href="function.sodium-crypto-sign-secretkey.html" class="function">sodium_crypto_sign_secretkey()</a></span>
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.sodium-crypto-sign-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Signed message (not encrypted).
  </p>
 </div>



</div></div></div></body></html>